
local xml = dofile("xml.lua");
local Window = dofile("window.lua");

function Window:LoadXmlFromText(xmltext)
    return xml.FromString(xmltext);
end

function Window:SaveXmlToText(xmlnode)
    return xml.ToString(xmlnode);
end

function Window:GetXmlNodeText(xmlnode)
    if (type(xmlnode) == "string") then
        return xmlnode
    end

    local text = "";
    for i, sub_xmlnode in ipairs(xmlnode) do
        text = text .. self:GetXmlNodeText(sub_xmlnode);
    end

    return text;
end

-- _G.window = Window:new():Init({"D:/workspace/cmake-test/assets/xmls/text.html"});
_G.window = Window:new():Init({template = [[<script>
local app = vue.createApp("test");
app:mount();
</script>]]});
-- _G.window = Window:new():Init({url = "D:/workspace/cmake-test/assets/xmls/script.html"});
window:Show();
return Window;